<ul>
<%if session[:user]%>
<%if session[:user].admin_flag=='Y'%>
  <li><a href="/user/backuppage">On Demand Backup</a></li>
  <li><a href="/auto_users">Manage User</a></li>
  <br/>
  <li><a href="/games">Create Session</a></li>
  <li><a href="/user/rungame">Run A Game</a></li>
<%end%>
<%end%>
  <li><a href="/user/joingame">Join A Game</a></li>
</ul>
<br/>
<%if session[:user]%>
<%game_histories = GameHistory.find(:all, :conditions=>["user_id=?",session[:user]], :order=>"created_at desc")%>
<h3>Game Histories</h3>
<table border="1">
  <tr align="center">
    <th>Game</th>
    <th>Player</th>
    <th>Type</th>
    <th>Code</th>
    <th>CurrentYear</th>
  </tr>
  <%game_histories.each do |gh|%>
  <tr align="center">
    <td><%begin%><%=gh.player.game.name%><%rescue%><%end%></td>
    <td><%begin%><%=gh.player.name%><%rescue%><%end%></td>
    <td><%begin%><%=gh.player.player_type%><%rescue%><%end%></td>
    <td><a href="/user/findgame?gencode=<%begin%><%=gh.player.gencode%><%rescue%><%end%>"><%begin%><%=gh.player.gencode%><%rescue%><%end%></a></td>
    <td><%begin%><%=gh.player.game.current_year%><%rescue%><%end%></td>
  </tr>
  <%end%>
</table>
<%end%>